﻿#ifndef __H_PAGEDATAJUDGE_H__
#define __H_PAGEDATAJUDGE_H__

#include <QWidget>

namespace Ui {
	class PageDataJudge;
}

class QGraphicsRectItem;
class QGraphicsGridLayout;
class QGraphicsScene;
class QTreeWidgetItem;


class CPageDataJudge
	: public QWidget
{
	Q_OBJECT
public:
	CPageDataJudge(QWidget* parent = 0, Qt::WindowFlags flags = 0);
	virtual ~CPageDataJudge();

	// 打开检测报告
	void openTestReport();

Q_SIGNALS:
	void sigHome();

protected:

	void init();

	void initData();
	// 清空报告相关页面数据
	void clear();
	// 清空非首页数据
	void clearNotFirstPageData();
	// 清空首页数据
	void clearHomePageData();

	void initCountryList();

	void initTestReportLiet();

	void showInitTabWidget(bool enable);

	void enableReportTabWidget();

	void openReportHomeInfo();
	void saveReportHomeInfo();

private Q_SLOTS:
	void slotSampleReportRightMenu(const QPoint& pos);
	
	void slotOpenReportTriggered(bool checked = false);
	void slotSaveReportTriggered(bool checked = false);
	void slotDeleteReportTriggered(bool checked = false);
	void slotExportReportTriggered(bool checked = false);
	void slotTreeDoubleClicked(QTreeWidgetItem* pItem, int column);

	void slotReportSave();

	void slotExportClicked();

private:
	void exportReportFile(uint32_t nTestReportId);

	void fillWordData(uint32_t nTestReportId, QByteArray& word);

	void fillReportData(uint32_t nTestReportId, QByteArray &word);

	void fileLawData(uint32_t nTestReportId, QByteArray &word);

	void fileSamplePropertyData(uint32_t nTestReportId, QByteArray &word);
	void fileTestAnalyseData(uint32_t nTestReportId, QByteArray &word);

	void fileResultData(uint32_t nTestReportId, QByteArray &word);

private:
	Ui::PageDataJudge* m_ui;
	// 标志ID起始值，逐渐递增
	uint32_t m_nIdentityStart;

};

#endif // __H_PAGEDATAJUDGE_H__
